<?php

/**
 * @name: HOTN AnimeList
 * @author: HammerOnTheNail
 * @link: http://code.google.com/p/hotnanimelist/
 */

$eplug_admin = TRUE;
include("../../../../class2.php"); 
//include(e_ADMIN."auth.php");
include(e_PLUGIN."hotn_animelist/Class/animelist_mysql.php");
include(e_PLUGIN."hotn_animelist/Class/animelist_options.php");

// Admin jog vizsgálata
if(!getperms("P"))
{ 
	header("location:".e_BASE."index.php"); 
}

// csapattag hozzáadása
if ($_POST['action'] == "create")
{
	$action = ".create.save";
	
	$add = array(
		"team_id" => $_POST['team_id'],
		"team_do" => $_POST['team_do'],
		"team_email" => $_POST['team_email']
	);
	
	$sql->db_Insert("hotn_animelist_team",$add);
}

// Csapattag szerkesztése
if ($_POST['action'] == "edit")
{
	$action = ".edit.save";
	
	$sql->db_Update("hotn_animelist_team","`team_do` = '".$_POST['team_do']."', `team_email` = '".$_POST['team_email']."' WHERE `team_id` ='".$_POST['user_id']."'");
}

// Csapattag törlése
if ($_POST['action'] == "delete")
{
	$action = ".edit.delete";
	
	$arg = "`team_id` = '".implode($_POST['team_id'],"' or `team_id` = '")."'";
	
	if ($sql->db_Delete("hotn_animelist_team",$arg) === 0)
	{
		$action = ".edit.no_select";
	}
}

// Visza irányítás és állapot továbbítása
header("Location: ".e_PLUGIN."hotn_animelist/Admin/admin_index.php?team".$action);
?>